package com.bizihang.security.core.validate.code.generator.impl;

import com.bizihang.security.core.validate.code.ValidateCode;
import org.apache.commons.lang.RandomStringUtils;
import org.springframework.web.context.request.ServletWebRequest;

/**
 * 短信验证码生成器
 *
 * @author 毕子航 951755883@qq.com
 * @date 2018/08/18
 */
public class SmsCodeGenerator extends AbstractCodeGenerator {
	@Override
	public ValidateCode generate(ServletWebRequest request) {
		String s = RandomStringUtils.randomNumeric(super.getSecurityProperties().getCode().getSms().getLength());
		return new ValidateCode(s, getSecurityProperties().getCode().getImage().getExpireIn());
	}
}
